package com.itheima.reggie.controller;


import com.itheima.reggie.common.R;
import com.itheima.reggie.entity.ShoppingCart;
import com.itheima.reggie.enums.HttpEnum;
import com.itheima.reggie.service.ShoppingCartService;
import com.itheima.reggie.utils.LoginThreadLocal;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Date;


/**
 * 购物车(ShoppingCart)表控制层
 *
 * @author shenjiaqi
 * @since 2024-02-06 10:44:24
 */
@RestController
@RequestMapping("shoppingCart")
public class ShoppingCartController {
    /**
     * 服务对象
     */
    @Resource
    private ShoppingCartService shoppingCartService;


    /**
     * 购物车列表展示
     *
     * @param args
     * @return
     */
    @GetMapping("/list")
    public R list(String[] args) {
        return null;
    }

    /**
     * 购物车新增
     *
     * @param
     * @return
     */
    @PostMapping("/add")
    public R add(@RequestBody ShoppingCart param) {
        if (null == param) {
            return R.error(HttpEnum.PARAMETER_NULL);
        }
        param.setUserId(LoginThreadLocal.getCurrent());
        param.setCreateTime(new Date());
        return null;
    }
}

